// Package sysin
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sysin

import (
	"context"
	"hotgo/internal/consts"
	"hotgo/internal/model/entity"
	"hotgo/internal/model/input/form"
	"hotgo/utility/validate"

	"github.com/gogf/gf/v2/errors/gerror"
	"github.com/gogf/gf/v2/os/gtime"
)

// OpsBannersUpdateFields 修改广告运营字段过滤
type OpsBannersUpdateFields struct {
	Name       string      `json:"name"       dc:"广告名称"`
	ImgUrl     string      `json:"imgUrl"     dc:"广告图片"`
	SourceType int         `json:"sourceType" dc:"广告跳转"`
	SourceId   int64       `json:"sourceId"   dc:"资源ID"`
	SourceUrl  string      `json:"sourceUrl"  dc:"资源地址"`
	Location   int         `json:"location"   dc:"广告位置"`
	StartTime  *gtime.Time `json:"startTime"  dc:"上线时间"`
}

// OpsBannersInsertFields 新增广告运营字段过滤
type OpsBannersInsertFields struct {
	Name       string      `json:"name"       dc:"广告名称"`
	ImgUrl     string      `json:"imgUrl"     dc:"广告图片"`
	SourceType int         `json:"sourceType" dc:"广告跳转"`
	SourceId   int64       `json:"sourceId"   dc:"资源ID"`
	SourceUrl  string      `json:"sourceUrl"  dc:"资源地址"`
	Location   int         `json:"location"   dc:"广告位置"`
	StartTime  *gtime.Time `json:"startTime"  dc:"上线时间"`
}

// OpsBannersEditInp 修改/新增广告运营
type OpsBannersEditInp struct {
	entity.OpsBanners
}

func (in *OpsBannersEditInp) Filter(ctx context.Context) (err error) {

	return
}

type OpsBannersEditModel struct{}

// OpsBannersViewInp 获取指定广告运营信息
type OpsBannersViewInp struct {
	Id int64 `json:"id" v:"required#广告ID不能为空" dc:"广告ID"`
}

func (in *OpsBannersViewInp) Filter(ctx context.Context) (err error) {
	return
}

type OpsBannersViewModel struct {
	entity.OpsBanners
}

// OpsBannersListInp 获取广告运营列表
type OpsBannersListInp struct {
	form.PageReq
	Name   string `json:"name"   dc:"广告名称"`
	Status int    `json:"status" dc:"状态"`
}

func (in *OpsBannersListInp) Filter(ctx context.Context) (err error) {
	return
}

type OpsBannersListModel struct {
	Id          int64       `json:"id"          dc:"广告ID"`
	Name        string      `json:"name"        dc:"广告名称"`
	ImgUrl      string      `json:"imgUrl"      dc:"广告图片"`
	SourceType  int         `json:"sourceType"  dc:"广告跳转"`
	SourceUrl   string      `json:"sourceUrl"   dc:"资源地址"`
	Location    int         `json:"location"    dc:"广告位置"`
	StartTime   *gtime.Time `json:"startTime"   dc:"上线时间"`
	Status      int         `json:"status"      dc:"状态"`
	ProductName string      `json:"productName" dc:"商品名称"`
}

// OpsBannersStatusInp 更新广告运营状态
type OpsBannersStatusInp struct {
	Id     int64 `json:"id" v:"required#广告ID不能为空" dc:"广告ID"`
	Status int   `json:"status" dc:"状态"`
}

func (in *OpsBannersStatusInp) Filter(ctx context.Context) (err error) {
	if in.Id <= 0 {
		err = gerror.New("广告ID不能为空")
		return
	}

	if in.Status <= 0 {
		err = gerror.New("状态不能为空")
		return
	}

	if !validate.InSlice(consts.StatusSlice, in.Status) {
		err = gerror.New("状态不正确")
		return
	}
	return
}

type OpsBannersStatusModel struct{}
